from llama_index.core import VectorStoreIndex
from llama_index.core.indices.base import BaseIndex
from llama_index.core.node_parser import SentenceSplitter


class RAG:
    @staticmethod
    async def create_index_local(documents) -> BaseIndex:
        node_parser = SentenceSplitter()
        nodes = node_parser.get_nodes_from_documents(documents)
        index = VectorStoreIndex(nodes)

        # index = VectorStoreIndex.from_documents(documents, show_progress=True)
        return index